package com.yyj.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yyj.domain.Goods;
import com.yyj.domain.User;
import com.yyj.service.GoodsService;

@Controller
public class GoodsController {
	@Autowired
	private GoodsService goodsService;

	@RequestMapping("/home.do")
	public String getAllGoods(Model model) {
		List<Goods> goods = goodsService.getAllGoods();
		model.addAttribute("goods", goods);
		return "home1";
	}

	@RequestMapping("/selectgoods.do")
	public String getAllSelectGoods(String name, Model model) {
		List<Goods> goods = goodsService.getAllSelectGoods(name);
		model.addAttribute("goods", goods);
		return "home";
	}

	@RequestMapping("/xiangq.do")
	public String getgoodsdescribe(String goods_id, Model model) {
		Goods good = goodsService.getGoodsdescribe(goods_id);
		model.addAttribute("goods", good);
		return "goods";
	}

	@RequestMapping("/marshowgoods.do")
	public String marshowgoods(Model model) {
		List<Goods> goods = goodsService.getAllGoods();
		model.addAttribute("goods", goods);
		return "management";
	}
}
